<template>
  <div>
    <template v-if="eslResolutionOptions.length > 0">
      <a-radio-group
        :options="eslResolutionOptions"
        v-model:value="modelValue"
        v-bind="$attrs"
        :disabled="disabled"
        v-if="type === 'radio'"
      ></a-radio-group>
      <!-- @vue-ignore -->
      <div>
        <a-select
          :options="eslResolutionOptions"
          v-model:value="modelValue"
          v-bind="$attrs"
          :disabled="disabled"
          allow-clear
          v-if="type === 'select'"
        ></a-select>
      </div>
    </template>

    <div v-else class="text-gray-400">没有数据</div>
  </div>
</template>

<script setup lang="ts">
import { eslResolutionOptions, getEslResolutionOptions } from '@/api/modules/utils/data';

const modelValue = defineModel<string>('modelValue');

withDefaults(
  defineProps<{
    disabled?: boolean;

    type?: 'radio' | 'select';
  }>(),
  {
    type: 'radio',
  },
);

onMounted(() => {
  getEslResolutionOptions();
});
</script>

<style lang="scss" scoped></style>
